package com.miyuan.base;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.miyuan.R;

import butterknife.ButterKnife;
import butterknife.Unbinder;
import com.miyuan.view.widget.LoadingDialog;

/**
 * Created by admin on 2018/4/17.
 */

public abstract class BaseFragment extends Fragment {
    public LoadingDialog loadingDialog;

    private Unbinder unbinder;
    public int fragmentLayout = -1;

    public int getFragmentLayout() {
        return fragmentLayout;
    }

    public void setFragmentLayout(int fragmentLayout) {
        this.fragmentLayout = fragmentLayout;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(getFragmentLayout(), container, false);
        unbinder = ButterKnife.bind(this, view);
        loadingDialog = new LoadingDialog(getActivity());
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
